cap cd "G:\My Drive\1_Research\arms\arms_2023\JOP_RnR"
use "arms_jop.dta", clear
export delimited using "G:\My Drive\1_Research\arms\arms_2023\JOP_RnR\arms_jop.csv", replace

*Label and log variables*
lab var log_ny_gdp_mktp_kd "GDP (log)"

gen log_russia_land_borderkm=log(russia_land_borderkm)
replace log_russia_land_borderkm=0 if log_russia_land_borderkm==.
lab var log_russia_land_borderkm "Land Border With Russia (km, log)"

gen russia_land_border_dummy=0
replace russia_land_border_dummy=1 if russia_land_borderkm!=. & russia_land_borderkm!=.

* Not for final use - this is code to address Anessa's PESCO question* 
gen pesco_dummy=0
replace pesco_dummy=1 if eu_year_dummy==1 & year>=2017
xtreg log_equipment log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs pesco_dummy i.year , fe robust cluster(ccode)

gen new_nato=0
replace new_nato=1 if nato_accession_year>=1998

************************
*Table 1: Summary Stats*
************************
cap gen defdiremployment_pop_000= defencedirectemployment_pop*1000
replace defdiremployment_pop_000=0 if defdiremployment_pop_000<0
cap gen irst_gdp_millions=irst_gdp*1000000
lab var defdiremployment_pop_000 "Direct Defense Industry/Population (000s)"
lab var irst_gdp_millions "Iron & Steel Production/GDP (millions)"
fsum defdiremployment_pop_000 equipment_gdp personnel_gdp operating_gdp infrastructure_gdp equipment personnel operating infrastructure milburden russia_threat ny_gdp_mktp_kd_zg sl_uem_totl_zs gc_xpn_comp_zs ny_gdp_mktp_kd ne_gdi_ftot_zs irst_gdp_millions ny_gdp_mktp_pp_kd fr_inr_rinr, label

*******************************************************
*Supplementary Table A: Country-Year Data Availability*
*******************************************************

tabstat year if log_equipment !=. &  log_defindirectemployment_pop !=., by(countryname) stats(min max n)

**************************************************************
*Table 2 OLS Direct Employment (DAG Adjusted - equipment)*
**************************************************************
#delimit;
sort ccode year;

*Model 1*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop, fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Employment/Population, Bivariate) label addtext(Fixed Effects, Country) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) replace;
estimates store bivariate;

*Model 2*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop i.year , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Employment/Population, Bivariate) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store yearfe;

*Model 3*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Allied Spillins) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store spillins;

*Model 4*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Russia Threat) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store threat; 

*Model 5*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat log_ny_gdp_mktp_kd ny_gdp_mktp_kd_zg i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(GDP) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store growth; 

*Model 6*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat log_ny_gdp_mktp_kd ny_gdp_mktp_kd_zg log_sl_uem_totl_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Unemployment) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 
estimates store unemployment;

*Model 7*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Factor Endowment) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store wages;

*Model 8*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs pesco_dummy new_nato i.year, fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(PESCO & New NATO Dummies) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;

*Model 9*
#delimit;
xtreg f.log_equipment log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Full Spec, Equipment/Milex) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 10*
#delimit;
xtreg f.log_equipment log_defdirempl_pop log_spillins russia_land_border_dummy ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Full Spec, Equipment/Milex, Russia Land Border Dummy) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 11*
#delimit;
xtreg f.log_operating_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Full Spec, O&M/GDP) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 12*
#delimit;
xtreg f.log_operating log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Full Spec, O&M/Milex) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 13*
#delimit;
xtreg f.log_personnel_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Full Spec, Personnel/GDP) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;

*Model 14*
#delimit;
xtreg f.log_infrastructure_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Full Spec, Infrastructure/GDP) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 15*
#delimit; 
xtreg f.log_infrastructure log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year, fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp.xls", ctit(Full Spec, Infrastructure/Milex) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 


******************************************
*Supplementary Table C: ECM Equipment/GDP*
******************************************
#delimit;
sort ccode year;
xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop  , fe robust cluster(ccode);
outreg2 using "arms_ecm.xls", ctit(Defense Employment/Population, Bivariate) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) replace;
xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins  , fe robust cluster(ccode);
outreg2 using "arms_ecm.xls", ctit(Allied Spillins) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat  , fe robust cluster(ccode);
outreg2 using "arms_ecm.xls", ctit(Russia Threat) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg  , fe robust cluster(ccode);
outreg2 using "arms_ecm.xls", ctit(Economic Growth) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs  , fe robust cluster(ccode);
outreg2 using "arms_ecm.xls", ctit(Unemployment) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ecm.xls", ctit(Year FE) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs d.log_gc_xpn_comp_zs l.log_gc_xpn_comp_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ecm.xls", ctit(Year FE) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs d.log_fr_inr_rinr l.log_fr_inr_rinr i.year  , fe robust cluster(ccode);
outreg2 using "arms_ecm.xls", ctit(Year FE) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;

estimates store ecm;

tabstat year if e(sample)==1, statistics (min max) by(countryname);

* Extract coefficients
#delimit;
matrix b = e(b);

* Get the coefficient for l.log_defdirempl_pop and l.log_equipment
#delimit;
scalar coef_log_defdirempl_pop = b[1, "l.log_defdirempl_pop"];
scalar coef_log_equipment_gdp = b[1, "l.log_equipment_gdp"];

* Calculate the long-run multiplier (ratio of the coefficients)
#delimit;
scalar long_run_multiplier = -coef_log_defdirempl_pop / coef_log_equipment_gdp;

* Display the result
#delimit;
di "Long-run multiplier: " long_run_multiplier;

*************************************************
*Supplementary Table A: ECM with equipment/milex*
*************************************************
#delimit;

sort ccode year;
xtreg d.log_equipment l.log_equipment d.log_defdirempl_pop l.log_defdirempl_pop  , fe robust cluster(ccode);
outreg2 using "arms_ecm_equipment_milex.xls", ctit(Defense Employment/Population, Bivariate) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) replace;
xtreg d.log_equipment l.log_equipment d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins  , fe robust cluster(ccode);
outreg2 using "arms_ecm_equipment_milex.xls", ctit(Allied Spillins) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment l.log_equipment d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat  , fe robust cluster(ccode);
outreg2 using "arms_ecm_equipment_milex.xls", ctit(Russia Threat) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment l.log_equipment d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg  , fe robust cluster(ccode);
outreg2 using "arms_ecm_equipment_milex.xls", ctit(Economic Growth) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment l.log_equipment d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs  , fe robust cluster(ccode);
outreg2 using "arms_ecm_equipment_milex.xls", ctit(Unemployment) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment l.log_equipment d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ecm_equipment_milex.xls", ctit(Year FE) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment l.log_equipment d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs d.log_gc_xpn_comp_zs l.log_gc_xpn_comp_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ecm_equipment_milex.xls", ctit(Year FE) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
xtreg d.log_equipment l.log_equipment d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs d.log_fr_inr_rinr l.log_fr_inr_rinr i.year  , fe robust cluster(ccode);
outreg2 using "arms_ecm_equipment_milex.xls", ctit(Year FE) label addtext(Fixed/Random Effects, FE) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;

estimates store ecm_milex;

tabstat year if e(sample)==1, statistics (min max) by(countryname);

* Extract coefficients
#delimit;
matrix b = e(b);

* Get the coefficient for l.log_defdirempl_pop and l.log_equipment
#delimit;
scalar coef_log_defdirempl_pop = b[1, "l.log_defdirempl_pop"];
scalar coef_log_equipment = b[1, "l.log_equipment"];

* Calculate the long-run multiplier (ratio of the coefficients)
#delimit;
scalar long_run_multiplier = -coef_log_defdirempl_pop / coef_log_equipment;

* Display the result
#delimit;
di "Long-run multiplier: " long_run_multiplier;


*****************************
*Appendix E xtabond estimate*
*****************************
#delimit;
xtabond log_equipment_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_sl_uem_totl_zs gc_xpn_comp_zs, maxldep(1) maxlags(2) vce(robust);
outreg2 using "arms_xtabond.xls", ctit(Arellano-Bond Dynamic Panel, GDP Share) label addtext() bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) replace;

estimates store xtabond;

xtabond log_equipment_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_sl_uem_totl_zs gc_xpn_comp_zs fr_inr_rinr , maxldep(1) maxlags(2) vce(robust);
outreg2 using "arms_xtabond.xls", ctit(Arellano-Bond Dynamic Panel, GDP Share) label addtext() bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;


*xtabond estimate for equipment only*
#delimit;
xtabond log_equipment log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_sl_uem_totl_zs gc_xpn_comp_zs , maxldep(1) maxlags(2) vce(robust);
outreg2 using "arms_xtabond.xls", ctit(Arellano-Bond Dynamic Panel, Budget Share) label addtext() bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;

xtabond log_equipment log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_sl_uem_totl_zs gc_xpn_comp_zs fr_inr_rinr , maxldep(1) maxlags(2) vce(robust);
outreg2 using "arms_xtabond.xls", ctit(Arellano-Bond Dynamic Panel, Budget Share) label addtext() bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store xtabond_milex;

***********************************
*Supplementary Table E: 2SLS Model*
***********************************

#delimit;


 xtivreg2 log_equipment (log_defdirempl_pop = l25.log_irst_gdp l25.log_equipment) l25.log_equipment if ccode!=2, first fe robust cluster(ccode);

xtreg log_defdirempl_pop l25.irst_gdp if e(sample)==1, fe;
outreg2 using "arms_2sls.xls", ctit(First Stage) label addtext(Fixed/Random Effects, FE) bdec(2) cdec(2) pdec(2) tdec(2) rdec(2) replace;
xtivreg2 log_equipment (log_defdirempl_pop = l25.log_irst_gdp l25.log_equipment) l25.log_equipment if ccode!=2, first fe robust cluster(ccode);
estimates store twosls_milex;
outreg2 using "arms_2sls.xls", ctit(Second Stage) label addtext(Fixed/Random Effects, FE) bdec(2) cdec(2) pdec(2) tdec(2) rdec(2) append;

xtreg log_defdirempl_pop l25.irst_gdp if e(sample)==1, fe;
outreg2 using "arms_2sls.xls", ctit(First Stage) label addtext(Fixed/Random Effects, FE) bdec(2) cdec(2) pdec(2) tdec(2) rdec(2) append;
xtivreg2 log_equipment_gdp (log_defdirempl_pop = l25.log_irst_gdp l25.log_equipment_gdp) l25.log_equipment_gdp if e(sample)==1, first fe robust cluster(ccode);
estimates store twosls;
outreg2 using "arms_2sls.xls", ctit(Second Stage) label addtext(Fixed/Random Effects, FE) bdec(2) cdec(2) pdec(2) tdec(2) rdec(2) append;


*Calculate AIC*
#delimit;
quiet xtivreg2 log_equipment (log_defdirempl_pop = l25.log_irst_gdp) l25.log_equipment if ccode!=2, first fe robust cluster(ccode);
xtreg log_defdirempl_pop l25.irst_gdp if e(sample)==1, fe;
quiet reg log_equipment log_defdirempl_pop if e(sample)==1;
estimates store baseline;
quiet xtreg d.log_equipment_gdp l.log_equipment_gdp d.log_defdirempl_pop l.log_defdirempl_pop d.log_spillins l.log_spillins d.russia_threat l.russia_threat d.ny_gdp_mktp_kd_zg l.ny_gdp_mktp_kd_zg d.log_sl_uem_totl_zs l.log_sl_uem_totl_zs i.year if ccode!=2 & e(sample)==1 , fe robust cluster(ccode);
estimates store ecmfullspec;
lrtest baseline twosls, stats force;
lrtest ecmfullspec twosls, stats force;


tabstat year if e(sample)==1, statistics (min max) by(countryname);

**************************************************************************************
*Figure 4: Coefficient Plots for All Estimates (adding ecm, xtabond, and 2sls to OLS)*
**************************************************************************************
	
*Coefplot*		   
#delimit;
set scheme gg_tableau;
coefplot bivariate yearfe spillins threat growth unemployment wages xtabond twosls ecm, 
    keep(log_defdirempl_pop l.log_defdirempl_pop L.log_defdirempl_pop)  
    xline(0, lcolor(red)) 
    ciopt(recast(rcap))
    yscale(off)
	xscale(range(-0.001 0.5))
    xtitle("") 
    xtitle("") 
	xlab(0(.2)2.4, labsize(vsmall) angle(45))
    graphregion(color(white)) 
    bgcolor(white) 
    msymbol(circle) 
    msize(medium) 
    mcolor(navy) 
    levels(95) 
    lcolor(navy) 
	mlabel()
	legend(order(1 "1: Bivariate, Country FE (27 Countries, 307 Obs.)" 3 "2:Bivariate, Country & Year FE (27 Countries, 307 Obs.)" 5 "3: Spillins (27 Countries, 284 Obs.)" 7 "4: Threat (27 Countries, 259 Obs.)" 9 "5: Growth (27 Countries, 203 Obs.)" 11 "6: Unemployment (27 Countries, 203 Obs.)" 13 "7: Wages (27 Countries, 203 Obs.)"
	15 "8: Arellano-Bond Estimate (27 Countries, 224 Obs.)"  17 "9:Two-Stage Least Squares (11 Countries, 125 Obs.)" 19 "10:Dynamic Error Correction Model (27 Countries, 224 Obs., 1-yr lag)"))
	legend(size(tiny) pos(6) rows(6))
	label()
	ylabel()
    title("Effect of Defense Employment on Equipment Spending, by Model", size(medium));
	
graph export coefplot.tif, replace;

*************************************************
*Supplementary Table G: OLS With Balanced Panels*
*************************************************

#delimit ;
keep if log_equipment_gdp != . & log_equipment != . & log_milburden != . & log_operating != . & log_operating_gdp != . & log_personnel != . & log_personnel_gdp != . & log_infrastructure != . & log_infrastructure_gdp != . & log_defdirempl_pop != . & log_spillins != . & russia_threat != . & ny_gdp_mktp_kd_zg != . & log_ny_gdp_mktp_kd != . & log_sl_uem_totl_zs != . & log_gc_xpn_comp_zs != . & ne_gdi_ftot_zs != . & pesco_dummy != . & new_nato != . & year != .;


**************************************************************
*Table G OLS Direct Employment (DAG Adjusted - equipment)*
**************************************************************
#delimit;
sort ccode year;

*Model 1*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop, fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Employment/Population, Bivariate) label addtext(Fixed Effects, Country) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) replace;
estimates store bivariate;

*Model 2*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop i.year , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Employment/Population, Bivariate) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store yearfe;

*Model 3*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Allied Spillins) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store spillins;

*Model 4*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Russia Threat) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store threat; 

*Model 5*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat log_ny_gdp_mktp_kd ny_gdp_mktp_kd_zg i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(GDP) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store growth; 

*Model 6*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat log_ny_gdp_mktp_kd ny_gdp_mktp_kd_zg log_sl_uem_totl_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Unemployment) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 
estimates store unemployment;

*Model 7*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Factor Endowment) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;
estimates store wages;

*Model 8*
#delimit;
xtreg f.log_equipment_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs pesco_dummy new_nato i.year, fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(PESCO & New NATO Dummies) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;

*Model 9*
#delimit;
xtreg f.log_equipment log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Full Spec, Equipment/Milex) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 10*
#delimit;
xtreg f.log_equipment log_defdirempl_pop log_spillins russia_land_border_dummy ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Full Spec, Equipment/Milex, Russia Land Border Dummy) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 11*
#delimit;
xtreg f.log_operating_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Full Spec, O&M/GDP) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 12*
#delimit;
xtreg f.log_operating log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Full Spec, O&M/Milex) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 13*
#delimit;
xtreg f.log_personnel_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Full Spec, Personnel/GDP) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append;

*Model 14*
#delimit;
xtreg f.log_infrastructure_gdp log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year  , fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Full Spec, Infrastructure/GDP) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 

*Model 15*
#delimit; 
xtreg f.log_infrastructure log_defdirempl_pop log_spillins russia_threat ny_gdp_mktp_kd_zg log_ny_gdp_mktp_kd log_sl_uem_totl_zs  log_gc_xpn_comp_zs ne_gdi_ftot_zs i.year, fe robust cluster(ccode);
outreg2 using "arms_ols_defdirectemploymentgdp_balanced.xls", ctit(Full Spec, Infrastructure/Milex) label addtext(Fixed Effects, Country & Year) bdec(4) cdec(4) pdec(4) tdec(4) rdec(4) append; 